cmake_minimum_required(VERSION 3.26)
project(Server)
set(CMAKE_CXX_STANDARD 20)
include_directories(SYSTEM "/foo/bar")

# 指出[头文件所在目录]的路径 -> 项目中的文件即可直接包含其他目录中的头文件
include_directories(
        ${PROJECT_SOURCE_DIR}/common
        ${PROJECT_SOURCE_DIR}/http
        ${PROJECT_SOURCE_DIR}/reactor
        ${PROJECT_SOURCE_DIR}/tcp
        ${PROJECT_SOURCE_DIR}/thread
        "/usr/local/ssl/include"
        "/usr/include/mysql"
        ${PROJECT_SOURCE_DIR}/serialize
        ${PROJECT_SOURCE_DIR}/mycrypto
        ${PROJECT_SOURCE_DIR}/game
        ${PROJECT_SOURCE_DIR}/database
        ${PROJECT_SOURCE_DIR}/test
)

# 添加子目录
add_subdirectory(common)
add_subdirectory(http)
add_subdirectory(reactor)
add_subdirectory(tcp)
add_subdirectory(thread)
add_subdirectory(serialize)
add_subdirectory(mycrypto)
add_subdirectory(game)
add_subdirectory(database)
add_subdirectory(test)

# 连接MySQL动态库
link_directories(/usr/lib64/mysql)

# 连接OpenSSL动态库
link_directories(/usr/local/ssl/lib64)

# 链接子目录中生成的静态库文件
link_libraries(tcp http reactor thread mycrypto serialize game database common)

# 指定[可执行程序的生成路径]: 根目录/src
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)

add_executable(Server main.cpp)